fix: preserve riscv trap pc - #2384
Open
Jvlegod wants to merge 1 commit into
Open
Conversation
Signed-off-by: Jvle <keke.oerv@isrc.iscas.ac.cn>
|
I closed #2400 in favor of this PR. One part from it is still useful. For instruction, load, and store address faults, RISC-V places the faulting address in I split the fix into a commit based directly on this PR: It does not change this PR's PC handling. I built it with |
Author
|
Hello @wtdcode. #2400 was closed in favor of this PR, @Kreijstal extracted the remaining change into c3cb167. I have verified that it applies cleanly on top of this branch. If you think this PR is suitable, I will :> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes RISC-V exception PC handling in interrupt hooks.
Previously, Unicorn unconditionally advanced the RISC-V PC by 4 before invoking
UC_HOOK_INTR. That behavior was added to solveecallresume problem reported in #1477, but it also made interrupt hooks observe the wrong PC for other exceptions, as reported in #1990.This change preserves the faulting instruction address while the interrupt hook is running, and only advances PC to the saved next PC after a handled RISC-V
ecall.Note:
ebreakwill follow theUC_ERR_INSN_INVALIDpath is not affected by this change.